import React from 'react';

function Son() {
    console.log('child render!');
    return <div>Son组件</div>;
}

function Parent(props) {
    const [count, setCount] = React.useState(0);
    return (
        <div>
            <button onClick={() => { setCount(count + 1) }}>加1</button><br />
            count:{count}
            {props.children}
            <hr />
            <div>
                <p>点击“加1”按钮</p>
                <p>打开控制台，看是否有“child render”的log，以此来判断看子组件是否被render</p>
            </div>
        </div>
    );
}


export default () => {
    return (
        <Parent>
            <Son />
        </Parent>
    )
}